<?php

namespace app\common\business;

use app\common\validate\Banner as ValObj;
use app\common\model\MallBanner as ModelObj;
use think\Exception;
use think\facade\Log;

class Banner extends Base
{
    /**
     * @var ValObj
     */
    protected ValObj $valObj;
    /**
     * @var ModelObj
     */
    protected ModelObj $modelObj;

    /**
     *
     */
    public function __construct()
    {
        $this->valObj = new ValObj();
        $this->modelObj = new ModelObj();
    }

    /**
     * @param array $where
     * @param string $field
     * @param string $order
     * @return array
     * @throws Exception
     */
    public function getBannerByList(array $where = [], string $field = '*', string $order = "sort desc ,id desc")
    {
        try {
            $result = $this->modelObj->getModelByListToArray($where, $field, $order);
        } catch (\Exception $e) {
            throw new Exception("查询失败");
        }
        return $result;
    }
}